Page objects

  • Base page object protocol. Defines basic properties and methods required by all page objects.

    Example:

    class MainPage: BaseAppPageProtocol {
        var view: XCUIElement
        public init(in view: XCUIElement) {
            self.view = view
        }
    }
    
    See more

    Declaration

    Swift

    public protocol BaseAppPageProtocol
  • Base implementation of the BaseAppPageProtocol. All page objects can inherit from this class.

    Example:

    class MainPage: BaseAppPage {
        var tableView: XCUIElement {
            return view.tables[Locators.tableView]
         }
    }
    
    private extension MainPage {
        enum Locators: String, Locator {
            case tableView
        }
    }
    
    See more

    Declaration

    Swift

    open class BaseAppPage : BaseAppPageProtocol
  • Page object protocol describing behaviour of modally presented view.

    Default implementation use close as accessibilityIdentifier.

    Example:

    class AboutTheAppPage: BaseAppPage, ModalPage {}
    
    let aboutTheAppPage = AboutTheAppPage(in: containerView)
    aboutTheAppPage.closeModalPage()
    

    Requires

    It is required to use close as accessibilityIdentifier in custom close button in the application to work with default implementation of this protocol.
    See more

    Declaration

    Swift

    public protocol ModalPage : BaseAppPageProtocol
  • Page object protocol describing behaviour of pushed.

    Default implementation use back as accessibilityIdentifier.

    Example:

    class AboutTheAppPage: BaseAppPage, PushedPage {}
    
    let aboutTheAppPage = AboutTheAppPage(in: containerView)
    aboutTheAppPage.goBack()
    

    Requires

    It is required to use back as accessibilityIdentifier in custom back button in the application to work with default implementation of this protocol.
    See more

    Declaration

    Swift

    public protocol PushedPage : BaseAppPageProtocol
  • Page object representing HealthKit permission view.

    It can only allow to tap on buttons:

    • Allow
    • Deny
    • Turn on all permissions
    • Turn off all permissions

    Example:

    let healthPermissionPage = HealthPermissionPage(in: self.app)
    healthPermissionPage.turnOnAllElement.tap()
    healthPermissionPage.allowElement.tap()
    
    See more